implementation *1000

Please click on ads to support us..

Python Code:

import math
from collections import deque
 
 
alfabet = {'a': 1, 'b': 2,'c': 3,'d': 4,'e': 5,'f': 6,'g': 7,'h': 8,'i': 9,'j': 10,'k': 11,'l': 12,'m': 13,'n': 14,'o': 15,'p': 16,'q': 17,'r': 18,'s': 19,'t': 20,'u': 21,'v': 22,'w': 23,'x': 24,'y': 25,'z': 26}

vector=[""]*10001
contor=0
numar=0
while contor<10001:
 numar+=1
 stringul=str(numar)
 stringul=stringul[::-1]

 for i in range(len(stringul)-1,-1,-1):
  contor+=1
  if contor<10001:
   vector[contor]=stringul[i]
  else:
   break
 


 
for i in range(0,1):
  n=int(input())
   
  
 print(vector[n])
  
 
 

  
  
 
 

C++ Code:

#include<bits/stdc++.h>
using namespace std;
#define ll long long int

int main()
{
    ll m,n,a,b;
    cin>>n;
    vector<ll>s,s1;
     for(ll i=1;i<10500;i++)
     {
         ll x=i;
         while(x!=0)
         {
             ll c=x%10;
              s.push_back(c);
              x/=10;
         }
         reverse(s.begin(),s.end());

         for(ll i=0;i<s.size();i++)
            s1.push_back(s[i]);

         s.clear();
     }


    cout<<s1[n-1]<<endl;


}


Comments

Submit
0 Comments
More Questions

1B - Spreadsheet
1177A - Digits Sequence (Easy Edition)
1579A - Casimir's String Solitaire
287B - Pipeline
510A - Fox And Snake
1520B - Ordinary Numbers
1624A - Plus One on the Subset
350A - TL
1487A - Arena
1520D - Same Differences
376A - Lever
1305A - Kuroni and the Gifts
1609A - Divide and Multiply
149B - Martian Clock
205A - Little Elephant and Rozdil
1609B - William the Vigilant
978B - File Name
1426B - Symmetric Matrix
732B - Cormen --- The Best Friend Of a Man
1369A - FashionabLee
1474B - Different Divisors
1632B - Roof Construction
388A - Fox and Box Accumulation
451A - Game With Sticks
768A - Oath of the Night's Watch
156C - Cipher
545D - Queue
459B - Pashmak and Flowers
1538A - Stone Game
1454C - Sequence Transformation